package com.hdoit.kylin.logical.groupActivity.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.tennetcn.common.dao.base.IFinderExpression;
import com.tennetcn.common.dao.base.impl.SuperDao;
import com.tennetcn.common.enums.OrderEnum;
import com.tennetcn.common.message.PagerModel;
import com.tennetcn.common.utils.FinderExpressionFactory;
import com.hdoit.kylin.logical.groupActivity.dao.IAcademicReportDao;
import com.hdoit.kylin.logical.groupActivity.model.AcademicReport;
import com.hdoit.kylin.logical.viewmodel.groupActivity.AcademicReportSearch;
/**
 * @author      lufu
 * @email       
 * @createtime  2017年08月01日 09:27:06
 * @comment
 */
@Component
public class AcademicReportDaoImpl extends SuperDao<AcademicReport> implements IAcademicReportDao{
	 private IAcademicReportDao academicReportDao;

	public IAcademicReportDao getAcademicReportDao() {
		return academicReportDao;
	}

	@Resource
	public void setAcademicReportDao(IAcademicReportDao academicReportDao) {
		this.academicReportDao = academicReportDao;
	}
	
	@Override
	public List<AcademicReport> queryList(AcademicReportSearch academicReportSearch,PagerModel pagerModel) {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("academicReport.*")
						.from(AcademicReport.class,"academicReport")
						.addOrder("academicReport.date", OrderEnum.desc);
		
		if(pagerModel==null){
			return queryList(finderExpression, academicReportSearch); 
		}
		return queryList(finderExpression, academicReportSearch, pagerModel);
	}

	@Override
	public List<AcademicReport> queryList(AcademicReportSearch academicReportSearch) {
		return queryList(academicReportSearch,null);
	}
}
